/*
 * @Author: qin
 * @Date:   2018-08-28
 * +----------------------------------------------------------------------
 * | admin [ 后台管理系统公共配置信息 ]
 * | 开发环境，意见库模块
 * +----------------------------------------------------------------------
 */
layui.define(['configure', 'configureCom', 'sessionFun'], function (exports) {
    var configureCom = layui.configureCom;
    var configure = layui.configure;
    var sessionFun = layui.sessionFun;
    var suggestBase = {
        //添加意见
        add: function (data) {
            return new Promise(function (resolve) {
                // 添加意见
                configureCom.postDataAjax(configure.EXPERT_ADD_SUGGEST_BASE_HTTP, data).then(function (res) {
                    resolve({code: res.code, msg: res.msg, result: res.result});
                });
            });
        },
        //修改意见库
        change: function (data) {
            return new Promise(function (resolve) {
                // 修改意见
                configureCom.postDataAjax(configure.EXPERT_CHANGE_SUGGEST_BASE_HTTP, data).then(function (res) {
                    resolve({code: res.code, msg: res.msg, result: res.result});
                });
            });
        },
        //删除意见库
        deleteSuggestBase: function () {
            return new Promise(function (resolve) {
                //获取修改前意见对象
                var suggestData = sessionFun.get(configure.SESSION_SUGGEST_BASE_DATA);
                configureCom.postDataAjax(configure.EXPERT_DELETE_SUGGEST_BASE_HTTP, {adviseBankId: suggestData.adviseBankId}).then(function (res) {
                    resolve({code: res.code, msg: res.msg, result: res.result});
                });
            });
        }
    };
    exports('suggestBase', suggestBase);
});